import "../../../scss/user_page/create_act.scss";

import $ from "jquery";
import Vue from "vue";

import "../../utils/remove_ad";
import "../../utils/oldcommon/layer";
import kindData from "./kindData"
$(function () {
  let page = {
    _app: {},
    _appData: kindData,
    _init: function () {
      let self = this;
      self._loadTemp();
    },
    _loadTemp: function () {

      let self = this;
      this._app = new Vue({
        el: "#app",
        data: self._appData,
        methods: {
          LookExample: function (kind) {
            console.log(kind);
            this.showCenterPops($('.pop-example'));
          },
          showCenterPops: function (ele) {
            // 显示弹窗,并让其显示在中间
            $(".mask").show();
            ele.show();
            let eleHeight = ele.height();
            ele.css({"margin-top": -eleHeight / 2 + "px","top":"50%"});
          },
          getUrl:function (url) {
            console.log(url);
            let enUrl = encodeURI(url);
            location.href = "../activity/noticeToUser.html?actUrl=" + enUrl;
          }
        }
      })
      self._afterTemp()
    },
    _afterTemp: function () {
      $("#app").on("click",".header_nav ul li", function () {
        console.log( )
        let left =  $(".header_nav ul").position().left;
        if($(this).index()  === 3 || $(this).index()  === 4){
          $(".header_nav ul").animate({"left":"-46%"});
        }else if($(this).index()  === 2 ){
          $(".header_nav ul").animate({"left":"-30%"});
        }else{
          $(".header_nav ul").animate({"left":"0"});
        }
        $(this)
          .addClass("select_nav")
          .siblings()
          .removeClass("select_nav");
        let name = $(this).attr("data-kind");
        $(".all_activity >  ul > li").each(function () {
          if (
            $(this)
              .attr("data-kind")
              .indexOf(name) > -1
          ) {
            $(this).show();
          } else {
            $(this).hide();
          }
        });
      });
      $("#spcail").click();
    }
  }
  page._init();


});
